﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
    <script src="../src/utilFn.js"></script>
    <script src="../utilPackage/jquery-1.11.3.min.js"></script>
    <link href="../utilPackage/utilFn.css" rel="stylesheet" />
</head>
<body>
    <div class="subPage">
        <div class="subPage-title">
            加密解密常用的方法
        </div>
        <div class="subPage-sub-title"></div>
        <div id="MD5_encryp" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>MD5.encryp</strong> </span> <span class="title-type">Function(String)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">              </span><span class="com">//*-------------------  32位加密//</span></code></li><li class="L2"><code class="lang-javascript"></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="com">//例如1：</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> str1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">MD5</span><span class="pun">.</span><span class="pln">encryp</span><span class="pun">(</span><span class="str">'12.3'</span><span class="pun">);</span><span class="com">//MD5  32位加密</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">str1</span><span class="pun">);</span><span class="pln">  </span><span class="com">//str1就是601712ded7a71b0842984ad41b6aad39;</span></code></li><li class="L6"><code class="lang-javascript"></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                </span><span class="com">//例如2：</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> str1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="pln">MD5</span><span class="pun">.</span><span class="pln">encryp</span><span class="pun">(</span><span class="str">'gly999'</span><span class="pun">);</span><span class="com">//MD5  32位加密</span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">str1</span><span class="pun">);</span><span class="pln">  </span><span class="com">//str1就是f9ca70bd405f43381350310187bd7986;</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.MD5.encryp(String)<br />
                    //MD5不可逆加密！  32位<br />
                    //加密在MD5对象中，<br />
                    //g.MD5.encryp=g.encrypMD5;

                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入字符串[String]
                </div>
                <div>
                    <textarea id="MD5_encrypInput" class="InputTextarea">12.3</textarea>
                </div>
                <div style="padding:10px;">
                </div>
                <div> <input id="MD5_encrypButton" type="button" value="执行  g.MD5.encryp(String)" /> </div>
                <div>
                    显示结果
                </div>
                <div>
                    <textarea id="MD5_encrypOutput" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#MD5_encrypButton").click(function () {
                        var str1 = $('#MD5_encrypInput').val();
                        var str2 = g.MD5.encryp(str1);
                        $('#MD5_encrypOutput').val(str2);
                    });
                </script>
            </div>
        </div>

        <div id="Escaping" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>Escaping</strong> </span> <span class="title-type">Function(String,String,Boolean)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">              </span><span class="com">//*-------------------转义字符串 避免语言冲突 ---//        </span></code></li><li class="L2"><code class="lang-javascript"></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="com">//例如1</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> str1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="typ">Escaping</span><span class="pun">(</span></code></li><li class="L5"><code class="lang-javascript"><span class="str">'&lt;c&gt;123456&lt;/c&gt;'</span></code></li><li class="L6"><code class="lang-javascript"><span class="pun">,</span><span class="pln"> </span><span class="str">'html'</span><span class="pun">,</span><span class="pln"> </span><span class="str">'false'</span><span class="pun">);</span><span class="com">//将html字符串转义</span></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">str1</span><span class="pun">);</span><span class="com">//str1是&amp;-#60;c&amp;-#62;123456&amp;-#60;/c&amp;-#62;  &amp;-#:表示&amp;#</span></code></li><li class="L8"><code class="lang-javascript"></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                </span><span class="com">//例如2：    </span></code></li><li class="L0"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> str1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="typ">Escaping</span><span class="pun">(</span></code></li><li class="L1"><code class="lang-javascript"><span class="str">'&amp;-#60;c&amp;-#62;123456&amp;-#60;/c&amp;-#62;'</span></code></li><li class="L2"><code class="lang-javascript"><span class="pun">,</span><span class="pln"> </span><span class="str">'html'</span><span class="pun">,</span><span class="kwd">true</span><span class="pun">);</span><span class="com">//将html字符串反转义 &amp;-#:表示&amp;</span></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">str1</span><span class="pun">);</span><span class="com">//str1是《c》123456《/c》</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.Escaping(String,String1,Boolean) <br />
                    //转义，有html字符串转义，sql字符串转义，默认为html<br />
                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入字符串<b>[String]</b>
                </div>
                <div>
                    <textarea id="EscapingInput" class="InputTextarea"><c>123456</c></textarea>
                </div>
                <div style="padding:10px;line-height:32px;">
                    参数1<b>[String1]</b>：<input id="EscapingCanshu1" type="text" value="html" /><br />
                    参数2<b>[Boolean]</b>：<input id="EscapingCanshu2" type="text" value="false" /><br />
                </div>
                <div> <input id="EscapingButton" type="button" value="执行  g.Escaping(String,String1,Boolean)" /> </div>
                <div>
                    显示结果
                </div>
                <div>
                    <textarea id="EscapingOutput" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#EscapingButton").click(function () {
                        var str1 = $('#EscapingInput').val();
                        var canshu1 = $('#EscapingCanshu1').val();
                        var canshu2 = eval($('#EscapingCanshu2').val());
                        var str2 = g.Escaping(str1, canshu1, canshu2);
                        $('#EscapingOutput').val(str2);
                    });
                </script>
            </div>
        </div>

        <div id="Base64_encode" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>Base64.encode</strong> </span> <span class="title-type">Function(String)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">  </span><span class="com">//*-------------------Base64加密//</span></code></li><li class="L2"><code class="lang-javascript"></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="com">//例如1：</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> str1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="typ">Base64</span><span class="pun">.</span><span class="pln">encode</span><span class="pun">(</span><span class="str">'12.3'</span><span class="pun">);</span><span class="com">//Base64加密</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">str1</span><span class="pun">);</span><span class="pln">  </span><span class="com">//str1就是MTIuMw==;</span></code></li><li class="L6"><code class="lang-javascript"></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                </span><span class="com">//例如2：</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> str1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="typ">Base64</span><span class="pun">.</span><span class="pln">encode</span><span class="pun">(</span><span class="str">'gly999'</span><span class="pun">);</span><span class="com">//Base64加密</span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">str1</span><span class="pun">);</span><span class="pln">  </span><span class="com">//str1就是Z2x5OTk5;</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.Base64.encode(String)<br />
                    //Base64加密<br />
                    //加密在Base64对象中
                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入字符串[String]
                </div>
                <div>
                    <textarea id="Base64_encodeInput" class="InputTextarea">12.3</textarea>
                </div>
                <div style="padding:10px;">
                </div>
                <div> <input id="Base64_encodeButton" type="button" value="执行  g.Base64.encode(String)" /> </div>
                <div>
                    显示结果
                </div>
                <div>
                    <textarea id="Base64_encodeOutput" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#Base64_encodeButton").click(function () {
                        var str1 = $('#Base64_encodeInput').val();
                        var str2 = g.Base64.encode(str1);
                        $('#Base64_encodeOutput').val(str2);
                    });
                </script>
            </div>
        </div>


        <div id="Base64_decode" class="subPage-part">
            <div class="subPage-part-title"><span class="title-name">g.<strong>Base64.decode</strong> </span> <span class="title-type">Function(String)</span> </div>
            <div class="subPage-part-code">
                <pre class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><code class="lang-javascript"></code></li><li class="L1"><code class="lang-javascript"><span class="pln">  </span><span class="com">//*-------------------Base64解密//</span></code></li><li class="L2"><code class="lang-javascript"></code></li><li class="L3"><code class="lang-javascript"><span class="pln">                </span><span class="com">//例如1：</span></code></li><li class="L4"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> str1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="typ">Base64</span><span class="pun">.</span><span class="pln">decode</span><span class="pun">(</span><span class="str">'MTIuMw=='</span><span class="pun">);</span><span class="com">//Base64解密</span></code></li><li class="L5"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">str1</span><span class="pun">);</span><span class="pln">  </span><span class="com">//str1就是12.3;</span></code></li><li class="L6"><code class="lang-javascript"></code></li><li class="L7"><code class="lang-javascript"><span class="pln">                </span><span class="com">//例如2：</span></code></li><li class="L8"><code class="lang-javascript"><span class="pln">                </span><span class="kwd">var</span><span class="pln"> str1 </span><span class="pun">=</span><span class="pln"> g</span><span class="pun">.</span><span class="typ">Base64</span><span class="pun">.</span><span class="pln">decode</span><span class="pun">(</span><span class="str">'Z2x5OTk5'</span><span class="pun">);</span><span class="com">//Base64解密</span></code></li><li class="L9"><code class="lang-javascript"><span class="pln">                console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">str1</span><span class="pun">);</span><span class="pln">  </span><span class="com">//str1就是gly999;</span></code></li></ol></pre>
            </div>
            <div class="subPage-part-explain">
                <tt>
                    g.Base64.decode(String)<br />
                    //Base64解密<br />
                    //解密在Base64对象中
                </tt>
            </div>
            <div class="subPage-part-explain">
                <div><b>测试方法</b></div>
                <div>
                    请输入字符串[String]
                </div>
                <div>
                    <textarea id="Base64_decodeInput" class="InputTextarea">MTIuMw==</textarea>
                </div>
                <div style="padding:10px;">
                </div>
                <div> <input id="Base64_decodeButton" type="button" value="执行  g.Base64.decode(String)" /> </div>
                <div>
                    显示结果
                </div>
                <div>
                    <textarea id="Base64_decodeOutput" class="OutputTextarea"></textarea>
                </div>
                <script>
                    $("#Base64_decodeButton").click(function () {
                        var str1 = $('#Base64_decodeInput').val();
                        var str2 = g.Base64.decode(str1);
                        $('#Base64_decodeOutput').val(str2);
                    });
                </script>
            </div>
        </div>



    </div>

</body>
</html>